home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58a.iso / extras / quake 3 source / Q3A_ToolSource.exe / Main / CommandsDlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-02  |  2.3 KB  |  89 lines

  1. // CommandsDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Radiant.h"
  6. #include "CommandsDlg.h"
  7. #include "MainFrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CCommandsDlg dialog
  17.  
  18.  
  19. CCommandsDlg::CCommandsDlg(CWnd* pParent /*=NULL*/)
  20.     : CDialog(CCommandsDlg::IDD, pParent)
  21. {
  22.     //{{AFX_DATA_INIT(CCommandsDlg)
  23.         // NOTE: the ClassWizard will add member initialization here
  24.     //}}AFX_DATA_INIT
  25. }
  26.  
  27.  
  28. void CCommandsDlg::DoDataExchange(CDataExchange* pDX)
  29. {
  30.     CDialog::DoDataExchange(pDX);
  31.     //{{AFX_DATA_MAP(CCommandsDlg)
  32.     DDX_Control(pDX, IDC_LIST_COMMANDS, m_lstCommands);
  33.     //}}AFX_DATA_MAP
  34. }
  35.  
  36.  
  37. BEGIN_MESSAGE_MAP(CCommandsDlg, CDialog)
  38.     //{{AFX_MSG_MAP(CCommandsDlg)
  39.     //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CCommandsDlg message handlers
  44.  
  45. BOOL CCommandsDlg::OnInitDialog() 
  46. {
  47.     CDialog::OnInitDialog();
  48.   m_lstCommands.SetTabStops(96);
  49.   int nCount = g_nCommandCount;
  50.  
  51.   CFile fileout;
  52.   fileout.Open("c:/commandlist.txt", CFile::modeCreate | CFile::modeWrite);
  53.   for (int n = 0; n < nCount; n++)
  54.   {
  55.     CString strLine;
  56.     char c = g_Commands[n].m_nKey;
  57.     CString strKeys = c;
  58.     for (int k = 0; k < g_nKeyCount; k++)
  59.     {
  60.       if (g_Keys[k].m_nVKKey == g_Commands[n].m_nKey)
  61.       {
  62.         strKeys = g_Keys[k].m_strName;
  63.         break;
  64.       }
  65.     }
  66.     CString strMod("");
  67.     if (g_Commands[n].m_nModifiers & RAD_SHIFT)
  68.       strMod = "Shift";
  69.     if (g_Commands[n].m_nModifiers & RAD_ALT)
  70.       strMod += (strMod.GetLength() > 0) ? " + Alt" : "Alt";
  71.     if (g_Commands[n].m_nModifiers & RAD_CONTROL)
  72.       strMod += (strMod.GetLength() > 0) ? " + Control" : "Control";
  73.     if (strMod.GetLength() > 0)
  74.     {
  75.       strMod += " + ";
  76.     }
  77.     strLine.Format("%s \t%s%s", g_Commands[n].m_strCommand, strMod, strKeys);
  78.     m_lstCommands.AddString(strLine);
  79.  
  80.     strLine.Format("%s \t\t\t%s%s", g_Commands[n].m_strCommand, strMod, strKeys);
  81.  
  82.     fileout.Write(strLine, strLine.GetLength());
  83.     fileout.Write("\r\n", 2);
  84.   }
  85.     fileout.Close();
  86.     return TRUE;  // return TRUE unless you set the focus to a control
  87.                   // EXCEPTION: OCX Property Pages should return FALSE
  88. }
  89.